package com.chap14;
import javax.swing.*;
import java.awt.*;

public class demopaint extends JFrame {
    public static void main(String[] args) {
        demopaint win=new demopaint();
    }
    demopaint(){
        Jp jp=new Jp();
        add(jp,BorderLayout.CENTER);
        setTitle("drawing");
        this.setSize(500,500);
        this.setLocation(300,300);
        this.setVisible(true);
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
    }
//    public void paint(Graphics g){
//        g.drawLine(0,0,100,150);
//    }
}
class Jp extends JPanel{
    public void paint(Graphics g){
        super.paint(g);
        g.drawLine(0,0,100,150);
        g.drawRect(50,60,70,80);
        g.drawOval(50,60,70,80);
        g.setColor(Color.BLUE);
        g.fillRect(50,60,70,80);
        g.setColor(Color.BLACK);
        g.fillOval(50,60,70,80);
        Font font=new Font("Times New Roman",Font.BOLD,50);
        g.drawString("java",100,150);
        Image im=Toolkit.getDefaultToolkit().getImage("C:\\Users\\24186\\Desktop\\IMG_20190721_072013.jpg");
        g.drawImage(im,100,150,this);
    }
}